package net.uhuijia.market.marketbanner.service.impl;

import net.uhuijia.constants.DBConst;
import net.uhuijia.market.marketbanner.service.MarketBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import net.uhuijia.appbase.service.CrudService;
import net.uhuijia.market.marketbanner.persistence.dao.MarketBannerDao;
import net.uhuijia.market.marketbanner.persistence.model.MarketBanner;
import net.uhuijia.market.marketbanner.persistence.model.MarketBannerExample;

import java.util.List;


@Service
@Transactional
public class MarketBannerServiceImpl
     extends CrudService<MarketBannerDao,MarketBanner,MarketBannerExample>
     implements MarketBannerService {

    /**
     * @param project 工程名称
     * @return 返回轮播图集合
     */
    @Override
    public List<MarketBanner> getByProject(String project) {
        MarketBannerExample example = new MarketBannerExample();
        example.setOrderByClause("REORDER ASC");
        MarketBannerExample.Criteria criteria = example.createCriteria();
        criteria.andIsEffectiveEqualTo(DBConst.TRUE);
        criteria.andProjectEqualTo(project);
        return mapper.selectByExample(example);
    }
}